import http from './http'
//分类 https://api-hmugo-web.itheima.net/api/public/v1/categories
export const categoriesApi=()=>{
    return http({
        url:'https://api-hmugo-web.itheima.net/api/public/v1/categories',
        method:'GET'
    })
}
//商品列表 https://api-hmugo-web.itheima.net/api/public/v1/goods/search
export const goodsApi=(query)=>{
    return http({
        url:'https://api-hmugo-web.itheima.net/api/public/v1/goods/search',
        method:'GET',
        params:{
            query
        }
    })
}
//商品详情 https://api-hmugo-web.itheima.net/api/public/v1/goods/detail
export const detailApi=(goods_id)=>{
    return http({
        url:'https://api-hmugo-web.itheima.net/api/public/v1/goods/detail',
        method:'GET',
        params:{
            goods_id
        }
    })
}
//生成订单 http://localhost:12345/api/order/create
export const orderApi=(data)=>{
    return http({
        url:'http://localhost:12345/api/order/create',
        method:'POST',
        data:{
            ...data
        }
    })
}
//订单详情 http://localhost:12345/api/order/getOrder/ak0jbjczik
export const getOrderApi=(orderId)=>{
    return http({
        url:'http://localhost:12345/api/order/getOrder/'+orderId,
        method:'GET',
    })
}
//订单列表 http://localhost:12345/api/order/getOrderList/zhangsan
export const getOrderListApi=(username)=>{
    return http({
        url:'http://localhost:12345/api/order/getOrderList/'+username,
        method:'GET',
    })
}
//支付 http://localhost:12345/api/order/pay
export const payApi=(data)=>{
    return http({
        url:'http://localhost:12345/api/order/pay',
        method:'POST',
        data:{
            ...data
        }
    })
}